import { get } from "../mock";

import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {
  studyForm,
  studyForms,
  studyQuery,
  studyPageVO,
  studyPageResult,
} from "./type";

/**
 * 获取分页数据
 *
 * @param queryParams
 */
export function getstudyPage(
  queryParams?: studyQuery
): AxiosPromise<studyPageResult> {
  return request({
    url: "/api/learnPath/select",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获取ID集合
 *
 * @param queryParams
 */
export function getstudyMenuIds(id: string): AxiosPromise<string[]> {
  return request({
    url: "/api/learnPath/selectById?id=" + id,
    method: "get",
  });
}

/**
 * 添加
 *
 * @param data
 */
export function addstudy(data: studyForms) {
  return request({
    url: "/api/learnPath/add",
    method: "post",
    data: data,
  });
}

// /**
//  * 更新
//  *
//  * @param id
//  * @param data
//  */
// export function updatestudy(id: string, data: studyForms) {
//   return request({
//     url: "/api/sys/user/activity/update?id=" + id,
//     method: "put",
//     data: data,
//   });
// }

/**
 * 批量删除，多个以英文逗号(,)分割
 *
 * @param ids
 */
export function deletestudy(id: string) {
  return request({
    url: "/api/learnPath/delete",
    method: "delete",
  });
}

/**
 * 获取用户ID集合
 *
 * @param queryParams
 */
export function getUserIds(ids: string): AxiosPromise<number[]> {
  return request({
    url: "/api/sys/user/info",
    method: "get",
  });
}
